package com.dhcc.service.impl;

import com.dhcc.entity.User;
import com.dhcc.repository.UserRepository;
import com.dhcc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserRepository userRepository;
    @Override
    public User getUserById(Integer uid) {
        return userRepository.findOne(uid);
    }

    @Override
    public List<User> listUser() {
        return userRepository.findAll();
    }

    @Override
    public void delUser(Integer uid) {
        userRepository.delete(uid);
    }

    @Override
    public void addUser(User user) {
        userRepository.save(user);
    }
}
